import requests
from bs4 import BeautifulSoup


def fetch_webpage_content(url):
    # 发送HTTP GET请求
    response = requests.get(url)

    # 检查请求是否成功
    if response.status_code == 200:
        # 使用BeautifulSoup解析HTML
        soup = BeautifulSoup(response.text, "html.parser")

        # 查找网页的标题
        title = soup.title.text if soup.title else "No title"
        print("Title:", title)

        # 查找网页的主要内容（这里以<p>标签为例）
        # 注意：实际应用中你需要根据目标网页的HTML结构来修改选择器
        paragraphs = soup.find_all("p")
        for paragraph in paragraphs:
            print(paragraph.text)
    else:
        print("Failed to retrieve data:", response.status_code)


# 示例URL
url = "https://esyrki.yintaos.buzz/index.php/vodplay/523279-1-1.html"  # 请替换成你要爬取的网页URL
fetch_webpage_content(url)
